import React from 'react'

/*
  安装：pnpm i pubsub-js
  使用：
    import PubSub from 'pubsub-js'
    // 发布
    PubSub.publish('test', 'hello world')

    // 订阅ß
    PubSub.subscribe('test', (msg, data) => {
        console.log(msg, data)
    })

    // 取消订阅
    PubSub.unsubscribe('test')
    // 取消所有订阅
    PubSub.clearAllSubscriptions()
    // 取消所有订阅，并返回所有订阅
    const subscriptions = PubSub.clearAllSubscriptions()
    console.log(subscriptions)
*/

import A from './components/A.js'
import B from './components/B.js'

export default function A008_PubSubJS() {
  return (
    <div>
      <h2>A008_PubSubJS 发布订阅</h2>

      父组件
      <hr />
      <A></A>

      <hr />
      <B></B>
    </div>
  )
}
